# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer:  Francesco Colista <fcolista@alpinelinux.org>

pkgname=icecast
pkgver=2.4.4
pkgrel=7
pkgdesc="Open source media server"
url="https://icecast.org/"
arch="all"
license="GPL-2.0-only"
install="$pkgname.pre-install"
pkgusers="icecast"
pkggroups="icecast"
makedepends="libxslt-dev libxml2-dev libogg-dev libvorbis-dev libtheora-dev openssl1.1-compat-dev curl-dev"
subpackages="$pkgname-doc $pkgname-openrc"
source="http://downloads.xiph.org/releases/icecast/icecast-$pkgver.tar.gz
	conf-change-owner.patch
	icecast.initd
"

# secfixes:
#   2.4.4-r0:
#     - CVE-2018-18820

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--localstatedir=/var \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-curl
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/icecast.initd "$pkgdir"/etc/init.d/icecast
}

sha512sums="e9ffb478cac2570891787455591d881a59185e067bb36f51706a7070cd9d82d80425ec8cf151f5ebb17d1b75654449fc760f8b82a1bb05f020b47ec09e46b4d0  icecast-2.4.4.tar.gz
3de3ed881a60f99d3e4cf656a46cdb157e95abcfa9bd44ebc7e13840a9b0ee84ec9e5b30878d67e42385dac5fa974694c215ad162b910c47b6b7864d474bf636  conf-change-owner.patch
56b71344cf72e15df2e24fda1c745365a67ebc2f3d167c75ca7ac00e40fc81bc8fb0b787d0feafee130718ce09013a11a150ce0efd359cf8b8ec0b003d17e7b4  icecast.initd"
